package com.client.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestOperations;

/**
 * Created by Administrator on 2017/3/11 0011.
 */
@Controller
public class Demo {
    @Autowired
    RestOperations userRestTemplate;

    @RequestMapping("/login")
    public String index() {
        return "login";
    }

    @RequestMapping("/user")
    @ResponseBody
    public String user() {
      String str= userRestTemplate.getForObject("http://localhost:8181/user/hello",String.class);
        return str;
    }

    @RequestMapping("/user/view")
    public String userView() {
        return "user";
    }
}
